//
//  SortDetailedTVC.m
//  MountEverestFM
//
//  Created by dllo on 15/10/30.
//  Copyright © 2015年 chenn. All rights reserved.
//

#import "FindMoreTableViewCell.h"

@interface FindMoreTableViewCell()
@property (nonatomic ,strong)UILabel *lable1;
@property (nonatomic ,strong)UILabel *lable2;
@property (nonatomic ,strong)UILabel *lable3;
@property (nonatomic ,strong)UILabel *lable4;
@property (nonatomic, strong)UIImageView *imageV1;
@property (nonatomic, strong)UIImageView *imageV2;
@property (nonatomic, strong)UIImageView *imageV3;
@property (nonatomic, strong)UIImageView *imageV4;
@property (nonatomic ,strong)UIImageView *imV;
@end

@implementation FindMoreTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.lable1=[[UILabel alloc]init];
        [self.contentView addSubview:self.lable1];
        
        self.lable2=[[UILabel alloc]init];
        [self.contentView addSubview:self.lable2];
        
        self.lable3=[[UILabel alloc]init];
        [self.contentView addSubview:self.lable3];
        
        self.lable4=[[UILabel alloc]init];
        [self.contentView addSubview:self.lable4];
        
        self.imageV1=[[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV1];
        
        self.imageV2=[[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV2];
        
        self.imageV3=[[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV3];
        
        self.imageV4=[[UIImageView alloc]init];
        [self.contentView addSubview:self.imageV4];
        
        self.imV=[[UIImageView alloc]init];
        [self.contentView addSubview:self.imV];    
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.imV.frame=CGRectMake(FM_Screen_Width-FM_Screen_Pts_Width*25,  FM_Screen_Pts_Height*50, FM_Screen_Pts_Width*10, FM_Screen_Pts_Height*10);
    
    self.imageV1.frame=CGRectMake(FM_Screen_Pts_Width*10, FM_Screen_Pts_Height*10,FM_Screen_Pts_Width* 90, FM_Screen_Pts_Height*90);
    
    self.lable1.frame=CGRectMake(FM_Screen_Pts_Width*110, FM_Screen_Pts_Height*15, FM_Screen_Width-FM_Screen_Pts_Width*140, FM_Screen_Pts_Height*15);
    self.lable2.frame=CGRectMake(FM_Screen_Pts_Width*110, FM_Screen_Pts_Height*50, FM_Screen_Width-FM_Screen_Pts_Width*150, FM_Screen_Pts_Height*15);
    self.lable2.font=[UIFont systemFontOfSize:15];
    self.lable2.alpha=0.5;
    
    self.lable3.frame=CGRectMake(FM_Screen_Pts_Width*135, FM_Screen_Pts_Height*80, FM_Screen_Width-FM_Screen_Pts_Width*30, FM_Screen_Pts_Height*15);
    self.lable3.font=[UIFont systemFontOfSize:15];
    self.lable3.alpha=0.5;
    
    self.lable4.frame=CGRectMake(FM_Screen_Pts_Width*235, FM_Screen_Pts_Height*77.5, FM_Screen_Width-FM_Screen_Pts_Width*30, FM_Screen_Pts_Height*20);
    self.lable4.font=[UIFont systemFontOfSize:15];
    self.lable4.alpha=0.5;
    
    self.imageV2.frame=CGRectMake(FM_Screen_Pts_Width*120, FM_Screen_Pts_Height*82, FM_Screen_Pts_Width*13, FM_Screen_Pts_Height*13);
    self.imageV3.frame=CGRectMake(FM_Screen_Pts_Width*219, FM_Screen_Pts_Height*82, FM_Screen_Pts_Width*13, FM_Screen_Pts_Height*13);
    
}

- (void)setFindMoreDic:(NSDictionary *)findMoreDic
{
    if (_findMoreDic != findMoreDic) {
        _findMoreDic = findMoreDic;
    }
    [self setFindMoreInfo:findMoreDic];
}

- (void)setFindMoreInfo:(NSDictionary *)findMoreDic
{
    self.lable1.text=[self.findMoreDic objectForKey:@"title"];
    self.imV.image=[UIImage imageNamed:@"cell_arrow_all.png"];
    
    self.lable2.text=[self.findMoreDic objectForKey:@"intro"];
    
    NSString *count = [[self.findMoreDic objectForKey:@"playsCounts"] stringValue];
    if (count == nil) {
        count = [[self.findMoreDic objectForKey:@"playTimes"] stringValue];
    }
    CGFloat f=[count floatValue];
    if (f<10000) {
        self.lable3.text=[NSString stringWithFormat:@"%.0f",f];
    }else{
        self.lable3.text=[NSString stringWithFormat:@"%.2f 万",f/10000];
    }
    NSString  *str=[[self.findMoreDic objectForKey:@"tracks"] stringValue];
    self.lable4.text=[str stringByAppendingString:@" 集"];
    
    [self.imageV1 sd_setImageWithURL:[NSURL URLWithString:[self.findMoreDic objectForKey:@"coverMiddle"]] placeholderImage:[UIImage imageNamed:@"find_kind_btn_default@3x.png"]];
    self.imageV2.image=[UIImage imageNamed:@"sound_playtimes@3x"];
    self.imageV3.image=[UIImage imageNamed:@"album_tracks@3x.png"];
}

@end
